package com.tdkj.action.backstage.shop;

import java.util.List;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.shop.BeanCreditRating;
import com.tdkj.service.shop.IBeanCreditRatingService;


public class CreditRatingAction extends BaseAction {
    
	private IBeanCreditRatingService creditRatingService;
	
	
	private Long id;
	private String name;
	private Integer scoreIntervalLower;
	private Integer scoreIntervalUpper;
	private String imgUrl;
	private Integer order;
	
	private BeanCreditRating creditRating ;
	
	private List<BeanCreditRating> creditRatings ;
	
	
	public String add() {
		creditRatingService.addCreditRating(name, scoreIntervalLower, scoreIntervalUpper, imgUrl, order);
		return execute();
	}
	
	public String update() {
		creditRatingService.updateCreditRating(id, name, scoreIntervalLower, scoreIntervalUpper, imgUrl, order);
		return edit();
	}

	public String del() {
		creditRatingService.deleteCreditRating(id);
		return execute();
	}
	
	public String edit() {
		creditRating = creditRatingService.getCreditRating(id);
		return "edit";
	}
	
	public String execute() {
		creditRatings = creditRatingService.getAllCreditRatings();
		return "success";
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the scoreIntervalLower
	 */
	public Integer getScoreIntervalLower() {
		return scoreIntervalLower;
	}

	/**
	 * @param scoreIntervalLower the scoreIntervalLower to set
	 */
	public void setScoreIntervalLower(Integer scoreIntervalLower) {
		this.scoreIntervalLower = scoreIntervalLower;
	}

	/**
	 * @return the scoreIntervalUpper
	 */
	public Integer getScoreIntervalUpper() {
		return scoreIntervalUpper;
	}

	/**
	 * @param scoreIntervalUpper the scoreIntervalUpper to set
	 */
	public void setScoreIntervalUpper(Integer scoreIntervalUpper) {
		this.scoreIntervalUpper = scoreIntervalUpper;
	}

	/**
	 * @return the imgUrl
	 */
	public String getImgUrl() {
		return imgUrl;
	}

	/**
	 * @param imgUrl the imgUrl to set
	 */
	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}

	/**
	 * @return the order
	 */
	public Integer getOrder() {
		return order;
	}

	/**
	 * @param order the order to set
	 */
	public void setOrder(Integer order) {
		this.order = order;
	}

	/**
	 * @return the creditRating
	 */
	public BeanCreditRating getCreditRating() {
		return creditRating;
	}

	/**
	 * @param creditRating the creditRating to set
	 */
	public void setCreditRating(BeanCreditRating creditRating) {
		this.creditRating = creditRating;
	}

	/**
	 * @return the creditRatings
	 */
	public List<BeanCreditRating> getCreditRatings() {
		return creditRatings;
	}

	/**
	 * @param creditRatings the creditRatings to set
	 */
	public void setCreditRatings(List<BeanCreditRating> creditRatings) {
		this.creditRatings = creditRatings;
	}

	/**
	 * @param creditRatingService the creditRatingService to set
	 */
	@Resource
	public void setCreditRatingService(IBeanCreditRatingService creditRatingService) {
		this.creditRatingService = creditRatingService;
	}
	
	

}
